<?php
/*由bean脚本生成 powerBy--joe*/
namespace app\common\validate;

use app\common\bean\UserAddressBean;

class UserAddressValidate extends BaseValidate
{

	static $all = 'all';
	static $add = 'add';
	static $edit = 'edit';
	static $pkId = 'id';

	public function __construct(array $rules = [], array $message = [], array $field = [])
	{
		parent::__construct($rules, $message, $field);
		$this->rule = [
			 UserAddressBean::$id => 'require', //
			 UserAddressBean::$province => 'require|max:255', //省份
			 UserAddressBean::$city => 'require|max:255', //城市
			 UserAddressBean::$area => 'require|max:255', //县区
			 UserAddressBean::$detail => 'require|max:255', //详细地址
			 UserAddressBean::$phone => 'require', //联系电话
			 UserAddressBean::$name => 'require|max:255', //收货人
			 UserAddressBean::$detailLat => 'require|max:255', //经度
			 UserAddressBean::$detailLng => 'require|max:255', //维度
			 UserAddressBean::$userId => 'require', //用户id
			 UserAddressBean::$default => 'require', //是否默认 1非默认 2默认
			 UserAddressBean::$updateAt => 'require', //
			 UserAddressBean::$createdAt => 'require', //
		];
		$this->message = [
			UserAddressBean::$id.POINST."require " => 'id必须', //
			UserAddressBean::$province.POINST."require " => 'province必须', //省份
			UserAddressBean::$city.POINST."require " => 'city必须', //城市
			UserAddressBean::$area.POINST."require " => 'area必须', //县区
			UserAddressBean::$detail.POINST."require " => 'detail必须', //详细地址
			UserAddressBean::$phone.POINST."require " => 'phone必须', //联系电话
			UserAddressBean::$name.POINST."require " => 'name必须', //收货人
			UserAddressBean::$detailLat.POINST."require " => 'detail_lat必须', //经度
			UserAddressBean::$detailLng.POINST."require " => 'detail_lng必须', //维度
			UserAddressBean::$userId.POINST."require " => 'user_id必须', //用户id
			UserAddressBean::$default.POINST."require " => 'default必须', //是否默认 1非默认 2默认
			UserAddressBean::$updateAt.POINST."require " => 'update_at必须', //
			UserAddressBean::$createdAt.POINST."require " => 'created_at必须', //
		];
		$this->scene = [
			self::$all => [
				UserAddressBean::$id,
				UserAddressBean::$province,
				UserAddressBean::$city,
				UserAddressBean::$area,
				UserAddressBean::$detail,
				UserAddressBean::$phone,
				UserAddressBean::$name,
				UserAddressBean::$detailLat,
				UserAddressBean::$detailLng,
				UserAddressBean::$userId,
				UserAddressBean::$default,
			],
			self::$add => [
                UserAddressBean::$province,
			],
			self::$edit => [
                UserAddressBean::$id,
			],
			self::$pkId => [
                UserAddressBean::$id,
            ],

		];
	}


}
